/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package etherblocks.mods.survival.entitysystem.systems;

import etherblocks.game.entitysystem.*;
import etherblocks.mods.survival.entitysystem.components.*;
import etherblocks.mods.survival.gui.ScreenController_IngameMenu;

/**
 *
 * @author Philipp
 */
public class DisplaySystem implements EntitySystem
{

    public DisplaySystem(int playerEntityID, ScreenController_IngameMenu screenController_IngameMenu){
        this.playerEntityID = playerEntityID;
        this.screenController_IngameMenu = screenController_IngameMenu;
    }
    private int playerEntityID;
    private ScreenController_IngameMenu screenController_IngameMenu;

    @Override
    public void onNextFrameCalculation(EntityMap entityMap, float lastTimePerFrame){
        HealthComponent healthComponent = entityMap.getComponent(playerEntityID, HealthComponent.class);
        if(healthComponent != null)
        {
            screenController_IngameMenu.setHealth(healthComponent.getHealth(), healthComponent.getHealthProportion());
        }
        HungerComponent hungerComponent = entityMap.getComponent(playerEntityID, HungerComponent.class);
        if(hungerComponent != null)
        {
            screenController_IngameMenu.setHunger(hungerComponent.getHunger(), hungerComponent.getHungerProportion());
        }
    }
}
